#!/bin/bash

phrase="missing value analysis"
lines_to_extract=267

awk -v p="$phrase" -v n="$lines_to_extract" '
    index($0, p) && !found { found=1; start=NR }
    found && NR >= start && NR < start+n { print }
' log.txt > gss_sample_stats.txt


phrase="estimates and significance"
lines_to_extract=166

awk -v p="$phrase" -v n="$lines_to_extract" '
    index($0, p) && !found { found=1; start=NR }
    found && NR >= start && NR < start+n { print }
' log.txt > gss_coefficients.txt


phrase="variance decomposition for each dependent variable"
lines_to_extract=49

awk -v p="$phrase" -v n="$lines_to_extract" '
    index($0, p) && !found { found=1; start=NR }
    found && NR >= start && NR < start+n { print }
' log.txt > gss_variance.txt

